package com.moto.enums;

public enum UserStatus {
	/**
	 * 用户被封号
	 */
	USER_IS_SEAL("1","用户被封号"),
	/**
	 * 用户未封号
	 */
	USER_NOT_SEAL("0","用户未封号");
	
	/**
	 * 状态Code 
	 */
	private String code;
	/**
	 * 状态
	 */
	private String status;

	private UserStatus(String code, String status) {
		this.code = code;
		this.status = status;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	/**
	 * 根据Code获取状态说明
	 * @param code
	 * @return
	 */
	public static String getStatus(String code){
		for (UserStatus	userStatus : UserStatus.values()) {
			if(userStatus.getCode().equals(code)){
				return userStatus.status;
			}
		}
		return null;
	}
	 
	public static void main(String[] args) {
		String status2 = UserStatus.getStatus("0");
		System.out.println(status2);
	}
}
